package com.iu.eblood.daoImpl;

import java.util.List;

import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.iu.eblood.dao.GenericDao;
import com.iu.eblood.daoInterfaces.FinancialDonationDao;
import com.iu.eblood.model.Event;
import com.iu.eblood.model.Financialdonation;
import com.iu.eblood.model.User;

@Repository("FinancialDonationDaoImpl")
public class FinancialDonationDaoImpl extends GenericDao<Financialdonation,Long>
implements FinancialDonationDao{

	
	public FinancialDonationDaoImpl() {
		super(Financialdonation.class);
	}
	
	
	public List<Financialdonation> allFinancialDonation(User user,String isActive) {
		
		Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
		
		List<Financialdonation> fdonations = 
				session.createQuery("from Financialdonation as fd where fd.user1=:user and fd.isactive=:isActive")
				.setEntity("user", user).setString("isActive", isActive).list();
		
		return fdonations;
		
	}
}
